package com.parking.common.pagination;

import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * 表示分页中的一页
 * @param <E> 页面内记录对象类型
 */
public class Page<E> {
    private List<E> items;//当前页包含的记录列表
    private int pn;//当前页页码(起始为1)
    private int pageSize; //当前页记录数量
    private long totalPages; //总页数
    private long totalItems; //总记录数
    
	public long getTotalPages() {
		return totalPages;
	}

	public void setTotalPages(long totalPages) {
		this.totalPages = totalPages;
	}

	public long getTotalItems() {
		return totalItems;
	}

	public void setTotalItems(long totalItems) {
		this.totalItems = totalItems;
	}

	public List<E> getItems() {
        return this.items == null ? Collections.<E>emptyList() : this.items;
    }

    public void setItems(List<E> items) {
        this.items = items;
    }

	public int getPn() {
		return pn;
	}

	public void setPn(int pn) {
		this.pn = pn;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
    
	@Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
